In the current code it could happen that we've menuItems and indicatorLabels
for sources that aren't anymore around, because in case a source is removed
we don't cleanup the their container objects.
Also, we should nullify InputManager's _currentSource when sources change
or it might point to some invalid data again.
So it could happen that we try to access an invalid menuitem or label
if a source change happens mentioning a source that has been deleted.
https://bugzilla.gnome.org/show_bug.cgi?id=788931
let sources = this._settings.inputSources;
let nSources = sources.length;
+ this._currentSource = null;
this._inputSources = {};
this._ibusSources = {};
for (let i in this._indicatorLabels)
this._indicatorLabels[i].destroy();
+ this._menuItems = {};
+ this._indicatorLabels = {};
+
let menuIndex = 0;
for (let i in this._inputSourceManager.inputSources) {
let is = this._inputSourceManager.inputSources[i];